class_name CardUI
extends Control

# 定义信号，作用：在拖动卡片时，重定其父级，脱离Hbox容器，避免受到Hbox的边界限制
signal reparent_requested(which_card_ui: CardUI)

@onready var color: ColorRect = $Color
@onready var state: Label = $State
# 连接状态机
@onready var card_state_machine: CardStateMachine = $CardStateMachine as CardStateMachine

func _ready() -> void:
	# 传递card_ui 自身，让状态机初始化，让状态机遍历card_ui的子节点，填充状态
	card_state_machine.init(self)

# 调用状态机的输入函数
func _input(event: InputEvent)->void:
	card_state_machine.on_input(event)
	
func _on_gui_input(event: InputEvent)->void:
	card_state_machine.on_gui_input(event)

# 信号回调
